package com.ning.cms.service.impl;

import com.ning.cms.service.ConfigService;
import com.ning.user.bean.Config;
import com.ning.user.dao.ConfigMapper;
import com.ning.user.dao.extend.ConfigExtendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ConfigServiceImpl implements ConfigService {
    @Autowired
    private ConfigMapper configMapper;

    @Autowired
    private ConfigExtendMapper configExtendMapper;


    @Override
    public List<Config> selectConfigStatusWithOn() {
        return configExtendMapper.selectConfigStatusWithOn();
    }

    @Transactional
    @Override
    public void addConfig(Config config) {
        config.setConfigStatus(0);
        configMapper.insert(config);
    }
}
